package leetcode.code1704;

import java.util.List;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public boolean halvesAreAlike(String s) {
		int cnt = 0;
		char[] cs = s.toCharArray();
		for (int i = 0, l = 0, r = s.length() - 1; i < s.length() >> 1; i++, l++, r--) {
			cnt += contains(cs[l]);
			cnt -= contains(cs[r]);
		}
		return cnt == 0;
	}

	private int contains(char c) {
		return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O'
				|| c == 'U' ? 1 : 0;
	}

	@Override
	public void debug4() {
		H.compare(true, this.halvesAreAlike(null));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
